package room;

import java.util.Collection;

import config.BanListType;
import config.LauncherHelper;
import config.ModeType;
import config.RuleType;

public class Room {
	
	   public int banListType = 0;
       public int timer = 0;
       public int rule = 0;
       public int mode = 0;

       public Boolean enabledPriority = false;
       public Boolean isNoCheckDeck = false;
       public Boolean isNoShuffleDeck = false;
       public Boolean isRanked = false;
       public Boolean isLocked = false;
       public Boolean hasStarted = false;
       public Boolean isAnimeMode = false;
       public Boolean isIllegal = false;

       public int startLp = 0;
       public int startHand = 0;
       public int drawCount = 0;

       public String roomName = "";

       public String[] playerList;

       //public Collection<String> spectatorList;
       //public Long hosterId;
       
       //public String pwd;
       
   	@Override
   	public String toString(){
   		String finString = "";
   		if(playerList == null || playerList.length < 1) return "";
   		
   		if(playerList[0] != "")
   			finString += playerList[0] + " ";
   		
        switch (rule)
        {
            case 0:
            	finString += "OCG ";
            	break;
            case 1:
            	finString += "TCG ";
            	break;
            case 2:
            	finString += "OCG/TCG ";
            	break;
            case 4:
            	finString += "Anime";
            	break;
            case 5:
            	finString += "Turbo ";
            	break;
        }
        
        switch (mode)
        {
            case 0:
            	finString += "Single ";
            	break;
            case 1:
            	finString += "Match ";
            	break;
            case 2:
            	finString += "Tag ";
            	break;
        }
        
        if(mode != 1){
        	finString += "Players: " + playerList.length + "/2 ";
        }else{
        	finString += "Players: " + playerList.length + "/4 " ; 
        }
                 
        if(isLocked){
        	finString += "LOCKED" ; 
        }else{
        	finString += "OPEN" ; 
        }
   		return finString;
   	}
   	
   	public String generateGameName(){
   		String gameString = "";
   		
   		String ruleStr = Integer.toString(rule);
   		
   		String modeStr =  Integer.toString(mode);
   		String banStr =  Integer.toString(banListType);
   		String timerStr =  Integer.toString(timer);
   		
   		String enablePrioStr = (enabledPriority) ? "T": "O";
   		String noCheckStr = (isNoCheckDeck) ? "T": "O";
   		String noShuffleStr  = (isNoShuffleDeck) ? "T": "O";
   		
   		String lpStr = Integer.toString(startLp);

   		
   		String rankedStr  = (isRanked) ? "R": "U";
   		String lockedStr = (isLocked) ? "L": "";
   	
   
   		gameString = ruleStr + modeStr + banStr + timerStr + enablePrioStr + 
   				noCheckStr + noShuffleStr + lpStr + "," + 
   				rankedStr + lockedStr + ",";
   		
   		System.out.println(gameString);
   		return gameString;
   	}
   

}

